package com.yiwei.zxp.api.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.yiwei.zxp.api.bean.ResponModel;
import com.google.gson.annotations.SerializedName;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xsooy-pc on 18-5-29.
 */

public class BuyerOrderListModel extends ResponModel implements Parcelable {

    public List<DatasBean> datas;

    public static class DatasBean implements Parcelable {
        /**
         * shop_info : {"shop_id":110,"shop_name":""}
         * order_info : {"order_no":"2018052810423552649104","num":5,"money":4990,"status":"0"}
         * items : [{"goods_id":2,"goods_no":"201805241015b06791423a7e","price":"998.00","num":"3","photos":["http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg","http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg","http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg"]},{"goods_id":3,"goods_no":"201805241012b06791423a7e","price":"998.00","num":"2","photos":["http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg","http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg","http://img3.dianhuohuo.shop/2018/05/23/201805231024507830.jpg"]}]
         */

        public ShopInfoBean shop_info;
        public OrderInfoBean order_info;
        public ArrayList<ItemGoodsDetail> items;

        public static class ShopInfoBean implements Parcelable {
            /**
             * shop_id : 110
             * shop_name :
             */

            public int shop_id;
            public String shop_name;
            public int is_self;
            public String shop_phone;


            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.shop_id);
                dest.writeString(this.shop_name);
                dest.writeInt(this.is_self);
                dest.writeString(this.shop_phone);
            }

            public ShopInfoBean() {
            }

            protected ShopInfoBean(Parcel in) {
                this.shop_id = in.readInt();
                this.shop_name = in.readString();
                this.is_self = in.readInt();
                this.shop_phone = in.readString();
            }

            public static final Creator<ShopInfoBean> CREATOR = new Creator<ShopInfoBean>() {
                @Override
                public ShopInfoBean createFromParcel(Parcel source) {
                    return new ShopInfoBean(source);
                }

                @Override
                public ShopInfoBean[] newArray(int size) {
                    return new ShopInfoBean[size];
                }
            };
        }

        public static class OrderInfoBean implements Parcelable {
            /**
             * order_no : 2018052810423552649104
             * num : 5
             * money : 4990
             * status : 0
             */

            public String order_no;
            public String num;
            public String money;
            public String status;
            public String deliver_fee_total;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.order_no);
                dest.writeString(this.num);
                dest.writeString(this.money);
                dest.writeString(this.status);
                dest.writeString(this.deliver_fee_total);
            }

            public OrderInfoBean() {
            }

            protected OrderInfoBean(Parcel in) {
                this.order_no = in.readString();
                this.num = in.readString();
                this.money = in.readString();
                this.status = in.readString();
                this.deliver_fee_total = in.readString();
            }

            public static final Creator<OrderInfoBean> CREATOR = new Creator<OrderInfoBean>() {
                @Override
                public OrderInfoBean createFromParcel(Parcel source) {
                    return new OrderInfoBean(source);
                }

                @Override
                public OrderInfoBean[] newArray(int size) {
                    return new OrderInfoBean[size];
                }
            };
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeParcelable(this.shop_info, flags);
            dest.writeParcelable(this.order_info, flags);
            dest.writeTypedList(this.items);
        }

        public DatasBean() {
        }

        protected DatasBean(Parcel in) {
            this.shop_info = in.readParcelable(ShopInfoBean.class.getClassLoader());
            this.order_info = in.readParcelable(OrderInfoBean.class.getClassLoader());
            this.items = in.createTypedArrayList(ItemGoodsDetail.CREATOR);
        }

        public static final Creator<DatasBean> CREATOR = new Creator<DatasBean>() {
            @Override
            public DatasBean createFromParcel(Parcel source) {
                return new DatasBean(source);
            }

            @Override
            public DatasBean[] newArray(int size) {
                return new DatasBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.datas);
    }

    public BuyerOrderListModel() {
    }

    protected BuyerOrderListModel(Parcel in) {
        this.datas = new ArrayList<DatasBean>();
        in.readList(this.datas, DatasBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<BuyerOrderListModel> CREATOR = new Parcelable.Creator<BuyerOrderListModel>() {
        @Override
        public BuyerOrderListModel createFromParcel(Parcel source) {
            return new BuyerOrderListModel(source);
        }

        @Override
        public BuyerOrderListModel[] newArray(int size) {
            return new BuyerOrderListModel[size];
        }
    };
}
